package com.elitel.frame.base.service.impl;

import com.elitel.frame.base.component.exportprojectdata.DataBaseConnInfo;
import com.elitel.frame.base.service.PageDetailsInfoService;
import com.elitel.frame.main.dao.ext.ExtPageDetailsinfoMapper;
import com.elitel.frame.main.entity.ext.PageDetailsinfoExt;
import com.elitel.frame.main.entity.ext.PrjServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PageDetailsInfoServiceImpl implements PageDetailsInfoService {
    @Autowired
    private ExtPageDetailsinfoMapper extPageDetailsinfoMapper;
    @Autowired
    DataBaseConnInfo dataBaseConnInfo;

    @Override
    public int deleteByPageCode(String pageCode) {
        return extPageDetailsinfoMapper.deleteByPageCode(pageCode);
    }

    @Override
    public int insertPageDetailsinfoBatch(Map<String, Object> mapParams) {
        if (dataBaseConnInfo.dataBaseType.equals("sqlite")){
            return extPageDetailsinfoMapper.insertPageDetailsinfoBatchSqlite(mapParams);
        }
        return extPageDetailsinfoMapper.insertPageDetailsinfoBatch(mapParams);
    }

    @Override
    public List<PageDetailsinfoExt> getQueryFieldListByServiceId(String serviceId, String pageCode) {
        return extPageDetailsinfoMapper.getQueryFieldListByServiceId(serviceId, pageCode);
    }

    @Override
    public List<PageDetailsinfoExt> getAllShowFieldByServiceId(String serviceId, String pageCode) {
        return extPageDetailsinfoMapper.getAllShowFieldByServiceId(serviceId, pageCode);
    }

    @Override
    public List<PageDetailsinfoExt> getAllShowFieldExecSQLByServiceId(String serviceId, String pageCode) {
        return extPageDetailsinfoMapper.getAllShowFieldExecSQLByServiceId(serviceId, pageCode);
    }

    @Override
    public List<PageDetailsinfoExt> getEditExecSQLByServiceId(String serviceId, String pageCode) {
        return extPageDetailsinfoMapper.getEditExecSQLByServiceId(serviceId,pageCode);
    }

    @Override
    public List<PrjServiceExt> getServiceBytype(Map<String, Object> mapParams) {
        return extPageDetailsinfoMapper.getServiceBytype(mapParams);
    }
}
